package user.zc.execute;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.function.Function;

public class ValidationQuery implements Function<Connection, Boolean> {
    @Override
    public Boolean apply(Connection conn) {
        Boolean isOk = false;
        try {
            Statement statement = conn.createStatement();
            ResultSet localResultSet = statement.executeQuery("SELECT 1 FROM DUAL");
            while (localResultSet.next()){
                isOk = (localResultSet.getInt(1)==1);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return isOk;
    }
}
